package com.zy;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

@SpringBootApplication
@EnableDiscoveryClient
public class ConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
/*
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
        NamingService namingService = (NamingService) annotationConfigApplicationContext.getBean("namingService");
        try {
            List<Instance> nacosDemoList = namingService.getAllInstances("nacosDemo");
            for (Instance instance : nacosDemoList) {
                System.out.println(instance.getServiceName());
            }
        } catch (NacosException e) {
            throw new RuntimeException(e);
        }
*/
    }
}
